$(document).ready(function(){
	Invitesq.login = function() {
		var tpl = '' +		
		'<form action="/auth/login/" method="post">' +
			'<input name="email" placeholder="Email Address"/>' +
			'<br/>' +
			'<input name="password" placeholder="Password"/>' +
			'<br/>' +
			'Remember Me' +
			'<input type="checkbox" name="remember-me" />' +
			'<br/>' +
			'<input type="submit" value="Login" />' +
		'</form>' +

		'<a href="/auth/facebook-login/">' +
		'<button>' +
			'Sign Up with Facebook' +
		'</button></a>' +
		'<a href="/auth/openid/google/">' +
		'<button>' +
			'Google' +
		'</button></a>' +
		'<a href="/auth/openid/yahoo/">' +
		'<button>' +
			'Yahoo' +
		'</button></a>' +
		'<a href="/auth/reset-password/">' +
		'<button>' +
			'Reset Password' +
		'</button></a>'
		
		$.fancybox(tpl);
	}
	
	$(document).on('ajaxError', function(e, jqxhr, settings, exception){
		if (jqxhr.status == 401) {
			Invitesq.login();
		}
	});
});
